<?php
header("Content-type:text/html; charset=gbk;");

$config = include('config.php');

$redis = include('conn.php');

$action = isset($_GET["action"]) ? $_GET["action"] : "";
$p1 = isset($_GET['p1']) ? addslashes($_GET['p1']) : "";
$p2 = isset($_GET['p2']) ? addslashes($_GET['p2']) : "";
$p3 = isset($_GET['p3']) ? addslashes($_GET['p3']) : "";
$p4 = isset($_GET['p4']) ? addslashes($_GET['p4']) : "";
$p5 = isset($_GET['p5']) ? addslashes($_GET['p5']) : "";

if($action == "get"){

	$result = $redis->get($p1);
	var_dump($result);exit;
	
}else if($action == "set"){
	
	$result = $redis->set($p1, $p2);
	var_dump($result);exit;
	
}else if($action == "setnx"){
	
	$result = $redis->setnx($p1, $p2);
	var_dump($result);exit;
	
}else if($action == "setex"){
	
	$result = $redis->setex($p1, $p2, $p3);
	var_dump($result);exit;
	
}else if($action == "incr"){
	if(intval($p2) > 0){
		$result = $redis->incr($p1, $p2);
	}else{
		$result = $redis->incr($p1);
	}
	var_dump($result);exit;
	
}else if($action == "incrBy"){

	$result = $redis->incrBy($p1, $p2);
	var_dump($result);exit;
	
}else if($action == "decr"){
	if(intval($p2) > 0){
		$result = $redis->decr($p1, $p2);
	}else{
		$result = $redis->decr($p1);
	}
	var_dump($result);exit;
	
}else if($action == "decrBy"){

	$result = $redis->decrBy($p1, $p2);
	var_dump($result);exit;
	
}else if($action == "getMultiple"){

	$result = $redis->getMultiple(array('str1','str2','str3'));
	var_dump($result);exit;
	
}

?>
